/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bis;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import obj.CommonVar;

/**
 *
 * @author Administrator
 */
public class FLBase {
    private ResultSet rs;
    private int id;
    protected String formname;
    public int getMaxidbyid() {
        try {
            rs = CommonVar.commondb.stmt.executeQuery("select max(id) from " + formname);
            if (rs.next()) {
                id = rs.getInt(1);
            }

        } catch (SQLException ex) {
            Logger.getLogger(FLBaseMgr.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            CommonVar.commondb.dcm.closeResultSet(rs);
            return id+1;
        }
    }
        public int getmaxidbybm() {
        try {
            String s="select * from " + formname;
            rs = CommonVar.commondb.stmt.executeQuery(s);
            if (rs.last()) {
                id = rs.getInt(1);
            }

        } catch (SQLException ex) {
            Logger.getLogger(FLBaseMgr.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            CommonVar.commondb.dcm.closeResultSet(rs);
            return id+1;
        }
    }

}
